<template>
	<view class="xinxibiangeng" :style="{paddingBottom:(lsbgList.length > 0?'30rpx':'0px')}">
		<view class="xinxibiangeng-top">{{userInfo.hyJibie == '免费会员' || !isAllow ? '示例：北京海诚通胜网络科技有限公司' : company}}</view>
		<view class="xinxibiangeng-wrap" v-show="userInfo.hyJibie !== '免费会员' && isAllow">
			<view class="xinxibiangeng-cell" v-for="(item,index) in lsbgList" :key="index">
				<view class="time">{{$u.timeFormat(item.bgjl_time, 'yyyy-mm-dd')}}</view>
				<view class="biangengxinxi">
					<view class="biangengxinxi-item">
						<view class="title">变更项</view>
						<view class="text">{{item.bgjl_item == '' ? '--' : item.bgjl_item}}</view>
					</view>
					<view class="biangengxinxi-item">
						<view class="title">变更前</view>
						<view class="text">{{item.bgjl_before == '' ? '--' : item.bgjl_before}}</view>
					</view>
					<view class="biangengxinxi-item">
						<view class="title">变更后</view>
						<view class="text">{{item.bgjl_after == '' ? '--' : item.bgjl_after}}</view>
					</view>
				</view>
			</view>
			<list-loading :status.sync="status" :listdata="lsbgList"  :isBottom.sync="isScrollBottm" :defindNull="!lsbgList.length">
				<view class="nullWrap">
					<image src="https://img.bidcenter.com.cn/uni/zanwushuju.png" mode="aspectFit"
						>
					</image>
				</view>
			</list-loading>
		</view>
		<view class="xinxibiangeng-wrap" v-show="userInfo.hyJibie == '免费会员'">
			<view class="xinxibiangeng-cell">
				<view class="time">2023-03-13</view>
				<view class="biangengxinxi">
					<view class="biangengxinxi-item">
						<view class="title">变更项</view>
						<view class="text">董事(理经理事)、监事</view>
					</view>
					<view class="biangengxinxi-item">
						<view class="title">变更前</view>
						<view class="text">张三[退出] 李四 王五 赵六 孙七 周八 吴九</view>
					</view>
					<view class="biangengxinxi-item">
						<view class="title">变更后</view>
						<view class="text">李四 王五 赵六 孙七 周八 吴九 郑十[新进]</view>
					</view>
				</view>
			</view>
			
			<view class="xinxibiangeng-limit">
				<image src='https://img.bidcenter.com.cn/uni/qiqing/lijikaitong.png' class="limit-img"></image>
				<view class="limit-text1">打破企业信息差</view>
				<view class="limit-text2">该功能为会员付费增值业务，需先开通会员</view>
				<view class="limit-btn">
					<view class="limit-btn-ljkt" @click="lijikaitong('1')">立即开通</view>
					<view class="limit-btn-rgkt" @click="toRengong">人工开通</view>
				</view>
			</view>
		</view>
		<view class="xinxibiangeng-wrap" v-show='iscishuyongjin'>
			<view class="xinxibiangeng-cell">
				<view class="time">2023-03-13</view>
				<view class="biangengxinxi">
					<view class="biangengxinxi-item">
						<view class="title">变更项</view>
						<view class="text">董事(理经理事)、监事</view>
					</view>
					<view class="biangengxinxi-item">
						<view class="title">变更前</view>
						<view class="text">张三[退出] 李四 王五 赵六 孙七 周八 吴九</view>
					</view>
					<view class="biangengxinxi-item">
						<view class="title">变更后</view>
						<view class="text">李四 王五 赵六 孙七 周八 吴九 郑十[新进]</view>
					</view>
				</view>
			</view>
			<view class="xinxibiangeng-limit">
				<image src='https://img.bidcenter.com.cn/uni/qiqing/lijikaitong.png' class="limit-img"></image>
				<view class="limit-text1">打破企业信息差</view>
				<view class="limit-text2">查看次数已用尽，请购买查看次数</view>
				<view class="limit-btn">
					<view class="limit-btn-ljkt" @click="lijikaitong('2')">立即购买</view>
					<view class="limit-btn-rgkt"@click="toRengong">人工开通</view>
				</view>
			</view>
		</view>
		
		
		
		
	</view>
</template>

<script>
	// import config from '@/common/config'
	export default {
		data() {
			return {
				// config:config,
				location:10881,
				company:this.company,
				lsbgList:[],
				comcode:this.comcode,
				vcode:this.vcode,
				page:1,
				pageSize:5,
				isScrollBottm:false,
				status:'loading',
				loadingText: '努力加载中...',
				// 自动加载，目前此状态用不到
				loadmoreText: '加载更多',
				nomoreText: '已全部加载完毕',
				isScrolltop:false,
				iscishuyongjin:false,
				isAllow:false,
				userInfo:uni.getStorageSync('userInfo') || {},
			}
		},
		async onLoad(option){
			this.comcode = option.comcode ? option.comcode : "0B4CFAB51A2379A4F42AD95EBE83B4FDB36D5ED7E36BE5BBD1C33E97F620302FEC48535E856D930FB266472126B47EAE4346660FC1486A1F783A5237DE57127D"
			this.vcode = option.vcode ? option.vcode : "7B19E61FBDCEC2A76D3E66E10149D078318C88846628FEBFF29112E81EE384816D5A703F63D4FB94",
			this.company = option.company
			await this.$onLaunched
			this.getgongneng()
		},
		async mounted(option){
			
			
		},
		computed:{
		
		},
		onReachBottom() {
			this.isScrollBottm = true
		    if (this.lsbgList.length < this.pageSize) {
		    	return
		    }
		    if (this.status !== 'nomore') {
		    	this.getlsbgData({
		    			page: ++this.page,
		    		},
		    		true
		    	);
		    }
		},
		methods: {
			init(){
				if(this.userInfo.hyJibie !=='免费会员' && this.iscishuyongjin){
					return
				}else{
					this.getlsbgData()
				}
			},
			getgongneng(){
				uni.$u.http.post('/public/ValidateAutMoHandler.ashx',{
					location:this.location,
					comcode: this.comcode,
					vcode: this.vcode,
					mids: "254",
				})
				.then(rs => {
					this.isAllow = rs.list[0].isAllow
					// LimitCount(限制数量) - CurrCount(已使用数量) 为 0 时，显示用尽区域
					const LimitCount = rs.list[0].limitData.LimitCount
					const CurrCount = rs.list[0].limitData.CurrCount
					
					if(LimitCount - CurrCount <= 0 ){
						this.iscishuyongjin = true
					}
					if(this.isAllow){
						this.getlsbgData()
					}else{
						this.iscishuyongjin=false
					}
				})
				.catch(err => {
					
				})
			},
			
			getlsbgData(loadmore = false){
				if (!loadmore) {
					this.status = 'loading';
					this.nomoreText="努力加载中..."
					this.lsbgList = [];
				}
				uni.$u.http
					.post('analysis/Company/CompanyBgjlHandler.ashx', {
						location: this.location,
						comcode: this.comcode,
						vcode: this.vcode,
						pageindex: this.page,
						pagesize: 5,
						mid_yx: 247,
						log_yx: 0,
						mid_cy: 254,
						log_cy: 0,
						log_type: 10464,
					})
					.then(rs => {
					   const data = rs.companybgjl
					   if (JSON.stringify(data) =="{}") {
					   	this.status = 'nomore';
					   	this.nomoreText = loadmore ? '已全部加载完毕' : '暂无数据'
						this.isScrolltop = false
					   	return;
					   } else {
					   	if (data.item.length < this.pageSize ) {
					   		this.status = 'nomore';
							this.nomoreText = '已全部加载完毕'
					   	} else {
					   		this.status = 'loading';
					   	}
					   }
					   data.item.map(item=>{
						   this.lsbgList.push(item)
					   })
					});
			},
			lijikaitong(value){
				if(value == '1'){
					uni.navigateTo({
						url: '/pagesOne/memberCenter/memberCenter?currentIndex=0&callback='+ encodeURIComponent(this.$mp.page.$page.fullPath)
					})
				}else{
					uni.navigateTo({
						url: '/pagesTwo/qiqing/pay/pay?type=' + '254' + '&comcode=' + this.comcode + '&vcode=' + this.vcode + '&company=' + this.company + '&pageurl=' + '/pagesTwo/qiqing/xinxibiangeng/index'
					})
				}
			},
			toRengong(){
				const zaixiankefu = this.lianxifangshi.ZaiXianBuMen
				wx.openCustomerServiceChat({
				  extInfo: {url: zaixiankefu},
				  corpId: 'ww1c379f23e62a624b',
				  showMessageCard:true,
				  sendMessageTitle:'会员业务开通',
				  sendMessageImg: 'https://img.bidcenter.com.cn/uni/share.png',
				  success(res) {
					  console.log(res)
					  
				  },fail(err){
					  console.log(err)
				  }
				})
				uni.$u.http
					.post('/wxapp/WxAppFuFeiSendMsgHandler.ashx', {
						location: this.location,
						ctid:'9348', // 9344为续费申请 9347为会员升级 9348为会员开通
					}).then(rs => {
				
					}).catch(err => {
						uni.$u.toast(err.msg);
					})
			}
		}
	}
</script>

<style lang="scss">
	page,.xinxibiangeng{
		background: #FAFAFA;
	}
	.xinxibiangeng-top{
		height: 98rpx;
		background: #f1f2f3;
		line-height: 98rpx;
		padding:0 28rpx;
		font-weight: bold;
		font-size: 28rpx;
		color: #3B3E45;
		position: sticky;
		top: 0;
		left: 0;
		width: 100%;
		box-sizing: border-box;
	}
	.xinxibiangeng-wrap{
		margin: 28rpx 28rpx 0;
	}
	.xinxibiangeng-cell{
		background: #FFFFFF;
		border-radius: 10rpx;
		margin-bottom: 20rpx;
		.time{
			padding: 20rpx 28rpx;
			font-weight: bold;
			font-size: 28rpx;
			color: #3B3E45;
			border-bottom: 1px solid #EEEEEE;
		}
		.biangengxinxi{
			padding: 20rpx 28rpx 0;
			.biangengxinxi-item{
				padding-bottom: 20rpx;
				.title{
					font-size: 24rpx;
					color: #ADB4C2;
					line-height: 40rpx;
				}
				.text{
					font-size: 24rpx;
					color: #6C717E;
					line-height: 33rpx;
				}
			}
		}
	}
	.xinxibiangeng-limit{
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		.limit-img{
			width: 400rpx;
			height: 311rpx;
		}
		.limit-text1{
			font-weight: bold;
			font-size: 28rpx;
			color: #3B3E45;
		}
		.limit-text2{
			font-size: 24rpx;
			color: #6C717E;
			margin: 20rpx 0 47rpx;
		}
		.limit-btn{
			display: flex;
			align-items: center;
			&-ljkt{
				width: 280rpx;
				height: 88rpx;
				line-height: 88rpx;
				text-align: center;
				background: linear-gradient( 90deg, #1F91FF 0%, #1D11FB 100%);
				border-radius: 4rpx;
				font-weight: bold;
				font-size: 32rpx;
				color: #FFFFFF;
				margin-right: 20rpx;
			}
			&-rgkt{
				margin-left: 20rpx;
				width: 280rpx;
				height: 88rpx;
				line-height: 88rpx;
				text-align: center;
				background: linear-gradient( 90deg, #FCE37E 0%, #FBA767 100%);
				border-radius: 4rpx;
				font-weight: bold;
				font-size: 32rpx;
				color: #82410E;
			}
		}
	}
	.foot-text{
		text-align:center;
		font-size:24rpx;
		color: #AAAAAA;
		padding-bottom:20rpx;
	}
</style>
